package com.pmoc.framework.core.config.driver.mysql;

import com.pmoc.framework.core.client.CallBack;
import com.pmoc.framework.core.config.driver.DataClient;
import com.pmoc.framework.core.dao.EntityDao;
import com.pmoc.framework.core.model.Entity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Configuration;

/**
 * MysqlClient
 *
 * @author humdeef
 * @summary MysqlClient
 * @since 2019-05-14 10:53
 */
@ConditionalOnBean(JPAConfig.class)
@Configuration
public class MysqlClient implements DataClient {

    @Autowired
    private EntityDao entityDao;

    @Override
    public Boolean add(Entity entity, CallBack callback) {
        // todo  具体的业务逻辑
        return true;
    }

    @Override
    public Boolean add(Entity entity) {
        Entity save = entityDao.save(entity);
        return save != null;
    }

    @Override
    public void consume(String appName) {

    }

    @Override
    public Boolean migrate(Entity entity) {
        return false;
    }

    @Override
    public void checkData(String appName) {

    }
}
